//
//  PercentCurretLinePlot.h
//  Balance
//
//  Created by oracle on 7/19/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "CorePlot-CocoaTouch.h"
#import "MetricsItem.h"


#define percentCurrentIdentifier  @"percentCurrentIdentifier"
#define priorYearIdentifier @"priorYearIdentifier"
#define percentOver91DaysDelinquentIdentifier  @"percentOver91DaysDelinquentIdentifier"

@protocol PercentCurrentLinePlotDelegate;

@interface PercentCurrentLinePlot : NSObject<CPTPlotDataSource,CPTPlotSpaceDelegate>{

@private
	
    CPTGraph *graph;
	
    CPTScatterPlot *currentPlot;
    CPTScatterPlot *priorYearPlot;
    CPTScatterPlot *percent91DaysDelinquentPlot;
    
    CPTPlotSpaceAnnotation *symbolTextAnnotation;
	
    NSMutableDictionary *metricsData;    
    
    NSArray *dailyKeys;
    
    NSMutableArray *dailyKeysInRange; 
    
    NSInteger totalNoOfDataPoints;
    NSInteger NoOfDataPointsInRange;

    NSString *selectedDateString;

    BOOL rangeChanged;
    BOOL isShowPercent91DaysDelinquent ;
    BOOL isShowpriorYear ;
    
    NSString *initStartDateString;
    NSDate *initStartDate;
	    	
    NSMutableArray *animationStartDailyKeys;
    NSMutableArray *animationUnit;
	
    NSUInteger timerCount;
    
    NSTimer *dataTimer;
    
    CPTScatterPlot *rulerPlot;
    
    NSInteger rulerIndex;
    NSString *rulerDateString;
    BOOL rulerEnabled;    
}

@property(nonatomic, retain) id<PercentCurrentLinePlotDelegate> delegate;

- (id) initWithMetricsData:(NSMutableDictionary*) data ;

- (void)renderInLayer:(CPTGraphHostingView *)layerHostingView withTheme:(CPTTheme *)theme;

 - (void)removePlot:(NSString *)plotIdentifier;

 - (void)addPlot:(NSString *)plotIdentifier;

 -(void)prepareAnimationData;


 -(void)respondToRangeChangeFromDate:(NSString *)newFromDateString toDate:(NSString *)newToDateString;

@end



//Delegate to notify the line that the location of the line has changed.
@protocol PercentCurrentLinePlotDelegate <NSObject> 

@required

- (void)respondToValueChange: (PercentCurrentLinePlot *)plot item:( MetricsItem *) item;

@end 
